import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
// import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'Home',
    meta: { title: '面板', keepAlive: true },
    component: () => import('@/pages/Home.vue'),
  },
]

const router = createRouter({
  history: createWebHashHistory(), // hash模式 有#号
  // history: createWebHistory(), // history模式 无#号
  routes,
})

router.beforeEach((to, _from, next) => {
  document.title = (to.meta.title! as string) || 'SC中文社区'
  next()
})

export default router
